﻿using System.Windows.Controls;
using System.Windows;

using Domain = DIT.Domain;
using Model = DIT.Client.Common.Model;

namespace DIT.Client.MVVM.TemplateSelector
{
    public class PersonalInfoTemplateSelector : DataTemplateSelector
    {
        public DataTemplate HUFInfoTemplate { get; set; }
        public DataTemplate IndividualInfoTemplate { get; set; }
        public DataTemplate FirmInfoTemplate { get; set; }

        public override DataTemplate SelectTemplate(object item, DependencyObject container)
        {
            Model.AccountModel cvm = item as Model.AccountModel;
            if (cvm == null)
                return null;
            switch (cvm.TaxPayerType)
            {
                case Domain.TaxPayerTypeENUM.HUF:
                    return HUFInfoTemplate;
                case Domain.TaxPayerTypeENUM.Individual:
                    return IndividualInfoTemplate;
                case Domain.TaxPayerTypeENUM.Firm:
                    return FirmInfoTemplate;
                default:
                    return null;
            }
        }
    }
}
